package com.demo.domain.service;

import com.demo.domain.adapter.ICSDNPort;
import com.demo.domain.model.ArticleFunctionRequest;
import com.demo.domain.model.ArticleFunctionResponse;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * 最终使用的service
 */
@Slf4j
@Service
public class CSDNArticleService {
    @Resource
    private ICSDNPort port;

    @Tool(description = "发布文章到csdn")
    public ArticleFunctionResponse saveArticle(ArticleFunctionRequest request) throws IOException {
        log.info("标题：{},内容：{},标签{}", request.getTitle(), request.getMarkdowncontent(), request.getTags());
        return port.writeArticle(request);
    }
}
